<template>
  <div>
<h2>管理员登录</h2>
<table class="table table-bordered">
  <tr>
    <td align="right">用户名</td>
    <td>
      <input type="text" v-model="state.aname">
    </td>
  </tr>
  <tr>
    <td align="right">密码</td>
    <td>
      <input type="password" v-model="state.apwd">
    </td>
  </tr>
  <tr>
    <td align="right"></td> 
    <td>
      <input type="button" value="登录" @click="Login">
    </td>
  </tr>
</table>
  </div>
</template>

<script setup lang="ts">
import { reactive,toRefs } from 'vue';
import axios from 'axios';  
import { useRouter } from 'vue-router';
const router=useRouter()
let data=reactive({
  state:{
    aname:'',
    apwd:''
  },
})
let {state}=toRefs(data)
function Login()
{
  let obj={
    aname:state.value.aname,
    apwd:state.value.apwd
  }
  axios({
    url:'/api/Member/MinLogin',
    method:'get',
    params:obj
  })
  .then(res=>
  {
    if(res.data.data!="")
  {
    alert("登录成功")
    router.push("/Show")
    
  }
  else
  {
    alert("登录失败")
  }
  
    
  })
  .catch(err=>{

  })
}
</script>

<style scoped>

</style>